package entities;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;

import javax.microedition.khronos.opengles.GL10;

import utility.vec2;

public abstract class CBaseObject implements IBaseInterface {
	// Object member variables.
	public String TAG = "default";
	protected vec2 pos = new vec2();
	protected vec2 vel = new vec2();
	protected float scale;
	protected float rotation;
	protected boolean alive = false;

	// Default Constructor
	public CBaseObject() {
		pos.setX(0.0f);
		pos.setY(0.0f);
		vel.setX(0.0f);
		vel.setY(0.0f);
		scale = 1.0f;
		alive = true;
	}

	/*****************************
	 * Class Methods
	 ******************************/
	public void Update(float time) {
	}

	public void Render(GL10 gl) {
	}

	public void Shutdown() {
		// TODO:
		// If we need to explicitly clean up any memory
		// we can call finalize in here as a sanity check.
	}

	/****************************
	 * Accessors
	 *****************************/
	public float getScale() {
		return scale;
	}

	public vec2 getPosition() {
		return pos;
	}

	public vec2 getVelocity() {
		return vel;
	}
	
	public float getPosX() {
		return pos.getX();
	}

	public float getPosY() {
		return pos.getY();
	}

	public float getVelX() {
		return vel.getX();
	}

	public float getVelY() {
		return vel.getY();
	}

//	public CSprite getSprite() {
//		return m_sprite;
//	}
	
	public float getRotation() {
		return rotation; 
	}
	
	public boolean getAlive() { 
		return alive;
	}

	/****************************
	 * Mutators
	 *****************************/
	public void setVelocity(vec2 v) {
		vel.setX(v.getX());
		vel.setY(v.getY());
	}
	public void setScale(float s) {
		scale = s;
	}

	public void setPosX(float _x) {
		this.pos.setX(_x);
	}

	public void setPosY(float _y) {
		this.pos.setY(_y);
	}

	public void setVelX(float _x) {
		this.vel.setX(_x);
	}

	public void setVelY(float _y) {
		this.vel.setY(_y);
	}
	
	public void setRotation( float rot )
	{
		rotation = rot;
	}
	
	public void setAlive(boolean a) 
	{
		alive = a;
	}
}
